﻿
@{
    ViewBag.Title = "用户中心";
    Layout = "~/Views/Shared/_UserLayout.cshtml";
}

@model UserCenterInfoModel

<!--内页样式-->
<div class="user_style clearfix" id="user">
    <div class="user_title"><em></em>用户中心</div>
    <!--用户中心布局样式-->
    <!--栏目名称-->

    @Html.Partial("~/Views/Shared/_PartialUserLeft.cshtml")

    <!--右侧内容展示-->
    <div class="right_style r_user_style">
        <div class="Notice"><span>系统最新公告:</span>为了更好地服务于【每日鲜】的会员朋友及读者 发表意见。</div>
        <!--用户基本信息-->
        <div class="clearfix">
            <div class="user_info clearfix">
                <div class="user_name_info">
                    <ul>
                        <li class="us_one">
                            <div class="name left">用户名: <b>@ViewBag.User.NiceName</b>,  欢迎你 [<a href="#">修改密码</a>]  </div>
                            <div class="right time"> <span>访问时间：@DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")</span></div>
                        </li>
                        @*<li class="us_two">
                                <dl><dt class="left">账户余额：</dt><dd>￥<b>0</b>元</dd></dl>
                                <dl><dt class="left">账户积分：</dt><dd><b>2355</b>分 &nbsp;<a href="#">[积分商城]</a></dd></dl>
                                <dl><dt class="left">用户等级：</dt><dd><b>普通会员</b></dd></dl>
                            </li>*@
                        <li class="us_Order">
                            <br />
                            <dl><dt class="left">用户等级：</dt><dd><b>普通会员</b></dd></dl>
                            <dl><dt class="left">未付款订单：</dt><dd><a href="#">@Model.InPayOrderCount</a></dd></dl>
                            <dl><dt class="left">完成订单：</dt><dd><a href="#">@Model.CompleteOrdeCount</a></dd></dl>
                        </li>

                        <li class="us_four">
                            <div class="Address"><em></em><a href="~/UserAddress/Index">地址管理&gt;</a></div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>

        <!--订单-->
        <div class="user_info_p_s clearfix">
            <div class="left_user_cont">
                <div class="us_Orders left clearfix">
                    <div class="Orders_name">
                        <div class="title_name">
                            <div class="Records">购买记录</div>
                            <div class="right select">
                                只记录你最近30天的购买记录
                            </div>
                        </div>
                    </div>
                    <table>
                        <thead>
                            <tr>
                                <th>产品名称</th>
                                <th>数量</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="orderRecords">
                            @{
                                int count = 1;
                                foreach (var userOrderRe in Model.UserOrderRecordModels)
                                {
                                    int length = userOrderRe.OrderRecord.Length;
                                    for (int i = 0; i < userOrderRe.OrderRecord.Length; i++)
                                    {
                                        <tr id="orderRecord@(count++)">
                                            <td class="img">
                                                <a target="_blank" href="~/Home/Detail?goodid=@userOrderRe.OrderRecord[i].GoodId">
                                                    <span class="left"><img thissrc="@("http://static.amortal.top/" + userOrderRe.ImgSrcs[i] + "?imageView2/2/w/200/h/200/interlace/1/q/100")"></span>
                                                    <span class="left">@userOrderRe.OrderRecord[i].GoodName</span>
                                                </a>
                                            </td>
                                            <td>@userOrderRe.OrderRecord[i].Count</td>
                                            <td>@userOrderRe.Order.StatusName</td>
                                            <td>
                                                <a target="_blank" href="~/Home/Detail?goodid=@userOrderRe.OrderRecord[i].GoodId">
                                                    查看
                                                </a>
                                            </td>
                                        </tr>
                                    }
                                }

                            }

                        </tbody>
                    </table>
                    <!--分页-->
                    <div class="pages_Collect">

                        @for (int i = 1; i <= Math.Ceiling(ViewBag.OrderRecordCount * 1.0 / 2); i++)
                        {
                            if (i == 1)
                            {
                                <a value="@i" href="javascript:void(0)" class="on page_index">@i</a>
                            }
                            else
                            {
                                <a value="@i" href="javascript:void(0)" class="page_index">@i</a>
                            }

                        }

                    </div>
                    <div class="us_jls">共 @ViewBag.OrderRecordCount 条记录</div>
                </div>
            </div>
            <!--右侧记录样式-->
            <div class="right_user_recording">
                <div class="us_Record">
                    <div id="Record_p" class="Record_p">
                        <div class="title_name">
                            <span class="name left">收藏记录</span>
                            <span class="pageState right"><span>1</span>/7</span>
                        </div>

                        <div class="hd">
                            <a class="next">&lt;</a>
                            <a class="prev">&gt;</a>
                        </div>
                        <div class="bd">
                            <ul>
                                @if (Model.UserCollectModels.Count() <= 0)
                                {
                                    <div>还没有收藏的商品，赶快去逛一逛吧</div>
                                }

                                @foreach (var userCollect in Model.UserCollectModels)
                                {
                                    <li>
                                        <div class="p_width">
                                            <div class="pic"><a target="_blank" href="~/Home/Detail?goodid=@userCollect.Good.Id"><img thissrc="@("http://static.amortal.top/"+userCollect.GoodImgSrc+"?imageView2/2/w/200/h/200/interlace/1/q/100")"></a></div>
                                            <div class="title"><a target="_blank" href="~/Home/Detail?goodid=@userCollect.Good.Id">@userCollect.Good.Name-@userCollect.Good.CatoryName</a></div>
                                            <div class="Purchase_info"><span class="p_Price">￥@userCollect.Good.Price</span> <a target="_blank" href="~/Home/Detail?goodid=@userCollect.Good.Id" class="Purchase">立即购买</a></div>
                                        </div>
                                    </li>
                                }


                            </ul>
                        </div>

                    </div>
                    <script type="text/javascript">jQuery("#Record_p").slide({ mainCell: ".bd ul", effect: "leftLoop", vis: 1, autoPlay: false });</script>
                </div>
            </div>
        </div>
        <!--结束-->
    </div>
</div>
<div class="footerbox">
    <!--友情链接-->
    <div class="Links">
        <div class="link_title">友情链接</div>
        <div class="link_address"><a href="#">四川茶叶协会</a>  <a href="#">链接地址</a>  <a href="#">链接地址</a>  <a href="#">链接地址 </a>   <a href="#">链接地址</a> <a href="#">链接地址</a> <a href="#">链接地址</a></div>
    </div>
</div>


@section FooterScript{

    <script type="text/javascript">
        $(function () {

            $("img[thissrc]").each(function (index, value) {
                src = $(this).attr('thissrc');
                $(this).attr('thissrc', "");
                $(this).attr('src', src);
            });

            $("#orderRecords tr").hide();

            changeOrderRecord(1);


            $(".pages_Collect a").click(function () {
                $(".pages_Collect a").removeClass("on");
                $(this).addClass("on");
                var index = $(this).attr("value");

                changeOrderRecord(parseInt(index))
            });

            function changeOrderRecord(pageIndex) {

                $("#orderRecords tr").hide();

                index = pageIndex * 2

                $("#orderRecord" + (index - 1)).show();
                $("#orderRecord" + index).show();

            }

        });
    </script>
}